package com.ld.service.impl;

import com.ld.doamin.PageListQuery;
import com.ld.doamin.Permission;
import com.ld.mapper.PermissionMapper;
import com.ld.service.IPermissionService;
import com.ld.basic.utils.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
@Service
public class PermissionServiceImpl implements IPermissionService {

    @Autowired
    private PermissionMapper mapper;

    @Override
    public PageList<Permission> queryPage(PageListQuery query) {
      Long total=  mapper.queryTotal(query);
     List<Permission> rows= mapper.queryList(query);

     return new PageList<Permission>(total,rows);
    }

    @Override
    public List<Permission> getTree() {

        return mapper.queryTree();
    }
}
